package com.chj.comp.common.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * rabbitmq消息信息表
 * </p>
 *
 * @author cuihui
 * @since 2022-06-14
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("mq_message_info")
@ApiModel(value="MqMessageInfo对象", description="rabbitmq消息信息表")
public class MqMessageInfo extends Model<MqMessageInfo> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "消息ID")
    @TableField("message_id")
    private String messageId;

    @ApiModelProperty(value = "消息类型：1-简单队列 2-工作队列 3-广播类型 4-路由类型 5-主题类型")
    @TableField("type")
    private String type;

    @ApiModelProperty(value = "交换机名称")
    @TableField("exchange")
    private String exchange;

    @ApiModelProperty(value = "队列名称")
    @TableField("queue")
    private String queue;

    @ApiModelProperty(value = "路由名称")
    @TableField("routing_key")
    private String routingKey;

    @ApiModelProperty(value = "消息")
    @TableField("message_info")
    private String messageInfo;

    @ApiModelProperty(value = "消息体")
    @TableField("message_body")
    private String messageBody;

    @ApiModelProperty(value = "消息状态：0-初始 1-已发送(已成功发送至rabbitmq) 2-已确认(消费者已确认收到) 3-已消费")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "发送次数")
    @TableField("send_num")
    private Integer sendNum;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private LocalDateTime updateTime;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
